import requests
import time
import random
arr = [
  "https://pic1.zhimg.com/50/v2-02a9bbe3e4ab6c75124b2f463f9ed90e_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-a0e7a473217c91ecbc247bd8046ca7a6_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-cdc56c6fd9e599a181758f41bb7abfa5_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-4fe711f3e3bb397969a9f766c639fdad_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-297501950588c8c25978b66367257c91_720w.jpg?source=c8b7c179",
  "https://pic1.zhimg.com/50/v2-6b50e3ac624a4c3246325817e4a8ba9f_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-74550808dd84eff9f11f7e619c5bbc73_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-a2168a6f6a1340a68234a80ce62672e9_720w.jpg?source=c8b7c179",
  "https://pica.zhimg.com/50/v2-46bcd90034f0a0b17219cd252b7aaa3c_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-4d0c0ce7ad9340e584af34393af960e9_720w.jpg?source=c8b7c179",
  "https://pic1.zhimg.com/50/v2-1f2f3009b2ee020ee8260c57416e82a4_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-ea7a5d5b6d7bb509680d63c9ac189498_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-9d6b1238df25ef541b34017b42686d77_720w.jpg?source=c8b7c179",
  "https://pic1.zhimg.com/50/v2-8451cce7cd6b62917e9fc041b3306749_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-9e202b337c4e4c06df2eff36907791d6_720w.jpg?source=c8b7c179",
  "https://pica.zhimg.com/50/v2-28835f2558d589a1cf3f84f451b8a31a_720w.jpg?source=c8b7c179",
  "https://pic1.zhimg.com/50/v2-f08d687c31db772375a56bb2bca29188_720w.jpg?source=c8b7c179",
  "https://pica.zhimg.com/50/v2-72277bce553f7b703e7c855b36b754a3_720w.jpg?source=c8b7c179",
  "https://pic1.zhimg.com/50/v2-7b44d4093bb64ae912aa30728e24053b_720w.jpg?source=c8b7c179",
  "https://pica.zhimg.com/50/v2-0d9757686bc5c68ab25d1a8dfbf016ba_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-6245cd5a0eda6e93c1f97615dab78636_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-63d9d4c5803e5319065dd974707dc6f8_720w.jpg?source=c8b7c179",
  "https://pic1.zhimg.com/50/v2-24300fbeace155be95b827771a56c9b5_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-e1463cc3dc29c60f7b295caa19073823_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-df35147f083ae6998c5147e4138229f7_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-761d744b69c44530fed1caeea97ba0a3_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-5fd28c80724e70f0149b0dedcf501ae2_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-63834241991907c37617d191ad351450_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-294166fbd1bfee8c73704b7ee7703a32_720w.jpg?source=c8b7c179",
  "https://pica.zhimg.com/50/v2-4e476cf0357ebff1ddc4c4fc733049b0_720w.jpg?source=c8b7c179",
  "https://pica.zhimg.com/50/v2-600cdc7c4bb41b364f65100dd315d33f_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-9fc5b59278f1a71668d383a367e4ea09_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-a2bb64d97226aff697ddae8a809503fa_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-fe8b8f407f43d83673b553dcbdd68c03_720w.jpg?source=c8b7c179",
  "https://pic1.zhimg.com/50/v2-84f2521c7d8b2e09999d25464c5ec125_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-79fb2b774879f9f294d6697c6b42b78b_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-6f964c2840a3e6db9dcbdc872f7d3510_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-095693c726c747804db1fba199152226_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-2f9b4dbf960497d75f401729d9ce4490_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-882996d3d26eef01fa7af255c4712809_720w.jpg?source=c8b7c179",
  "https://pic1.zhimg.com/50/v2-61f9560903f851e205ac6e11daf0bce9_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-4e9bd4a6dc80e7ee1d67e36849e03530_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-bc485848982fa3cbdcc663aa7a905f79_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-3f9d728d92e3b33b545ec59dfd0167da_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-20faa69c4b6bf3d7d317e238f9e7c2cd_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-86a6efe41fc3732daca17e680a660fe0_720w.jpg?source=c8b7c179",
  "https://pica.zhimg.com/50/v2-2a1a12da0f6377ae2a6c3a49c4a404b3_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-0f74b762d8044c9866d0e803a83169d1_720w.jpg?source=c8b7c179",
  "https://pic1.zhimg.com/50/v2-f4ba5b1d816695040633a5cec4d13420_720w.jpg?source=c8b7c179",
  "https://picx.zhimg.com/50/v2-70fdd85ed520b64a00f3d042bd44edd7_720w.jpg?source=c8b7c179",
  "https://pic1.zhimg.com/50/v2-f88336b01e72fbbbc94ff803dd35d556_720w.jpg?source=c8b7c179",
  "https://pic1.zhimg.com/50/v2-2af989950aec02063465c58d43bde95c_720w.jpg?source=c8b7c179"
]

def savePic(img_url):
    # 图片链接
    arrOne = img_url.split('?')
    arrTwo = arrOne[0].split('/')
    save_path = "C:\\Users\\wangwenli\\Pictures\\zhihu\\" + arrTwo[len(arrTwo) - 1]
    #"D:\\aaa\\" + arrTwo[len(arrTwo) - 1]
    print(save_path)
    # 获取留片内容
    response =requests.get(img_url)
    # # 保存图片到本迪文件奖
    with open(save_path, 'wb') as file :
        file.write(response.content)

# savePic('https://pic1.zhimg.com/50/v2-0bf0b7a394f917a44ec0d8a9201051bc_720w.jpg?source=c8b7c179')
for item in arr:
    savePic(item)

    print('图片下载完毕。。。。')
    time.sleep(random.randint(10, 99))
print('所有下载完成')
